<template>
  <div class="page">
    <div class="flex flex-direction padding" style="padding-top: 10vh">
      <div class="padding-sm" ref="cg">
        <van-button @click="onTrackAnim">购物车</van-button>
      </div>
      <div class="padding-sm flex">
        <ok-upload @change="onUploadChange"
                   class="padding-right"
                   multiple="multiple"
                   accept="image/gif, image/jpeg, image/png">
          <van-button>upload</van-button>
        </ok-upload>
        <ok-upload @change="onUploadChange" class="padding-right">
          <van-button>upload</van-button>
        </ok-upload>
      </div>
    </div>
    <ok-track-anim ref="ok-track-anim"></ok-track-anim>
  </div>
</template>

<script type="es6">
export default {
  name: "",
  data() {
    return {};
  },
  mounted() {
  },
  methods: {
    async onUploadChange(e) {
      let file = e.files[0];
      let zip = await this.$utils.file.isZIP(file);
      // let png = await this.$utils.file.isPNG(file);
      // console.log("jpg:" + jpg);
      console.log(zip);
      /*console.log(file.slice(0, 8));
      let blob = file.slice(0, 8);
      blob.arrayBuffer().then(res => {
        console.log(res);
      });*/
    },
    onTrackAnim() {
      let track = this.$refs['ok-track-anim'];
      let cg = this.$refs['cg'];
      track.drop(cg);
    }
  }
}
</script>

<style lang="scss" scoped>

</style>